package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.Customer;
import com.atguigu.jxc.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.Objects;

@RestController
@RequestMapping("/customer")
public class CustomerController {
    @Autowired
    private CustomerService customerService;

    //客户列表分页
    @PostMapping("/list")
    public Map<String, Object> page(Integer page, Integer rows, String  customerName){
        Map<String,Object> map=customerService.page(page,rows,customerName);
        return map;
    }

    //客户添加和修改
    @PostMapping("/save")
    public ServiceVO save(Integer customerId,Customer customer){
       return customerService.save(customerId,customer);
    }

    //删除客户
    @PostMapping("/delete")
    public ServiceVO delete(String  ids){
       return customerService.delete(ids);
    }
}
